﻿package mortal.game.scene3D.player.head
{
    import Message.Game.*;
    import com.gengine.utils.pools.*;
    import flash.display.*;
    import flash.filters.*;
    import mortal.game.view.chat.chatPanel.*;
    import mortal.game.view.chat.chatPrivate.*;
    import mortal.game.view.chat.chatViewData.*;

    public class TextRecord extends Sprite implements IDispose
    {
        private var _lineHeight:Number;
        private var _lineWidth:Number;
        private var _content:String;
        private var _chatMsg:SChatMsg;
        private var _chatData:ChatData;
        private var _analysisType:int = 1;
        private var _defaultColor:int = 16575690;
        private var _aryPlayer:Array;
        private var _isFilter:Boolean = true;
        private var _isShowTitle:Boolean = false;
        private var _faceAuthortiy:int = 1;
        private var _chatItem:ChatItem;
        private var _chatItemData:ChatItemData;

        public function TextRecord()
        {
            return;
        }// end function

        public function get faceAuthortiy() : int
        {
            return this._faceAuthortiy;
        }// end function

        public function set faceAuthortiy(param1:int) : void
        {
            this._faceAuthortiy = param1;
            return;
        }// end function

        public function init(param1:Number = 260, param2:Number = 21) : void
        {
            this._lineWidth = param1;
            this._lineHeight = param2;
            return;
        }// end function

        public function draw() : void
        {
            var _loc_1:ChatData = null;
            if (!this._chatItem)
            {
                this._chatItemData = ObjectPool.getObject(ChatItemData);
                this._chatItem = ObjectPool.getObject(ChatItem);
                this._chatItem.setFilter([new DropShadowFilter(0, 120, 14273975, 0.8, 2, 2, 0.5), new GlowFilter(595746, 0.5, 2, 2, 10)]);
                this.addChild(this._chatItem);
            }
            this._chatItem.lineWidth = this._lineWidth;
            this._chatItem.lineHeight = this._lineHeight;
            switch(this._analysisType)
            {
                case ChatAnalysisType.AnalysisTypeFace:
                {
                    _loc_1 = new ChatData();
                    _loc_1.content = this._content;
                    _loc_1.chatColor = this._defaultColor;
                    _loc_1.titleColor = this._defaultColor;
                    _loc_1.fontSize = 14;
                    _loc_1.faceAuthority = this._faceAuthortiy;
                    this._chatItemData.cellVector = ChatMessageWorking.getCellDatas(_loc_1);
                    this._chatItem.groupVector = this._chatItemData.getContentElement();
                    break;
                }
                case ChatAnalysisType.AnalysisTypeChat:
                {
                    this._chatItemData.cellVector = ChatMessageWorking.getCellDataByPlayerInfo(this._chatData);
                    this._chatItemData.cellVector = this._chatItemData.cellVector.concat(ChatMessageWorking.getCellDatas(this._chatData));
                    this._chatItem.groupVector = this._chatItemData.getAllElements();
                    break;
                }
                case ChatAnalysisType.AnalysisTypeHtml:
                {
                    this._chatItemData.cellVector = ChatMessageWorking.getCellDatasFilterHtml(this._content);
                    this._chatItem.groupVector = this._chatItemData.getContentElement();
                    break;
                }
                case ChatAnalysisType.AnalysisTypeRumor:
                {
                    this._chatItemData.cellVector = ChatMessageWorking.getCellDatasByAnalyzeRumor(this._content, this._aryPlayer ? (this._aryPlayer) : (new Array()));
                    this._chatItem.groupVector = this._chatItemData.getContentElement();
                    break;
                }
                default:
                {
                    break;
                }
            }
            this._chatItemData.dispose();
            return;
        }// end function

        public function get content() : String
        {
            return this._content;
        }// end function

        public function set content(param1:String) : void
        {
            this._content = param1;
            return;
        }// end function

        public function get analysisType() : int
        {
            return this._analysisType;
        }// end function

        public function set analysisType(param1:int) : void
        {
            this._analysisType = param1;
            return;
        }// end function

        public function get defaultColor() : int
        {
            return this._defaultColor;
        }// end function

        public function set defaultColor(param1:int) : void
        {
            this._defaultColor = param1;
            return;
        }// end function

        public function get aryPlayer() : Array
        {
            return this._aryPlayer;
        }// end function

        public function set aryPlayer(param1:Array) : void
        {
            this._aryPlayer = param1;
            return;
        }// end function

        public function get chatMsg() : SChatMsg
        {
            return this._chatMsg;
        }// end function

        public function set chatMsg(param1:SChatMsg) : void
        {
            this._chatMsg = param1;
            this._chatData = new ChatData();
            this._chatData.copyFromChatMsg(param1);
            return;
        }// end function

        public function get isFilter() : Boolean
        {
            return this._isFilter;
        }// end function

        public function set isFilter(param1:Boolean) : void
        {
            this._isFilter = param1;
            return;
        }// end function

        public function get isShowTitle() : Boolean
        {
            return this._isShowTitle;
        }// end function

        public function set isShowTitle(param1:Boolean) : void
        {
            this._isShowTitle = param1;
            return;
        }// end function

        public function get lineHeight() : Number
        {
            return this._lineHeight;
        }// end function

        public function set lineHeight(param1:Number) : void
        {
            this._lineHeight = param1;
            return;
        }// end function

        public function get lineWidth() : Number
        {
            return this._lineWidth;
        }// end function

        public function set lineWidth(param1:Number) : void
        {
            this._lineWidth = param1;
            return;
        }// end function

        override public function get height() : Number
        {
            if (this._chatItem)
            {
                return this._chatItem.height;
            }
            return 0;
        }// end function

        public function dispose(param1:Boolean = true) : void
        {
            if (this._chatItemData)
            {
                this._chatItemData.dispose();
                this._chatItemData = null;
            }
            if (this._chatItem)
            {
                this._chatItem.dispose();
                this._chatItem = null;
            }
            this._lineHeight = 260;
            this._lineWidth = 21;
            this._content = null;
            this._chatMsg = null;
            this._analysisType = 1;
            this._defaultColor = 16777215;
            this._aryPlayer = null;
            this._isFilter = true;
            this._isShowTitle = false;
            ObjectPool.disposeObject(this);
            return;
        }// end function

    }
}
